#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int m, n, k;
    cin >> m;
    while (m--)
    {
        scanf("%d %d", &n, &k);
        vector<int> alls;
        alls.resize(2 * n);
        for (int i = 0; i < 2 * n; ++i)
        {
            scanf("%d", &alls[i]);
        }
        while (k--)
        {
            vector<int> tmp(alls.begin(), alls.end());
            for (int i = 0; i < n; ++i)
            {
                alls[2 * i] = tmp[i];
                alls[2 * i + 1] = tmp[i + n];
            }
        }
        for (int i = 0; i < 2 * n; ++i)
        {
            printf("%d ", alls[i]);
        }
        printf("\n");
    }
    return 0;
}